package com.opesoft.fw.ajax;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import junit.framework.TestCase;

import org.apache.log4j.Logger;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;

public class Try extends TestCase
{
	Logger log=Logger.getLogger(this.getClass());
	
	// 测试如何用反射的方式来调用静态方法
	public void test1() throws SecurityException,NoSuchMethodException,IllegalArgumentException,IllegalAccessException,InvocationTargetException
	{
		Method m=TestBO.class.getMethod("echo1",new Class[]{String.class});
		m.invoke(TestBO.class,"This is a test !");
	}

	public void test3() throws JSONException
	{
		String str="{p1:56}";
		JSONObject j=new JSONObject(str);
		JSONTokener tokener=new JSONTokener(str);
		
		log.debug(j.getLong("p1"));
		
		log.debug(tokener.nextValue().getClass());
	}
	
	public void test2()
	{

	}
	
}
